﻿@model PagedList<code_generate_entity>
@{
    ViewData["Title"] = "代码生成器";
}
@section Scripts{
<script>
    layui.use(function(){
        layer = layui.layer;
    });

    $(function(){
        $(".a_generate").on("click",function(){
            layer.msg("正在生成....");
            var id = $(this).data("id");
            $.ajax({
                url: "/v6admin/code_generate/generate",
                data:{
                    id: id
                },
                success: function(res){
                    layer.msg(res.msg + " 打开项目文件夹 wwwroot/uploads/code");
                }
            });
        });
    });
</script>
}
<div class="layui-card">
    <div class="layui-card-header">
        @ViewData["Title"]
    </div>
    <div class="layui-card-body">
        <a asp-action="select_table" class="layui-btn layui-btn-normal">选择表导入</a>
        <table class="layui-table">
            <thead>
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.table_name)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.table_desc)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.model_name)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.business_name)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.function_name)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.remark)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.create_time)
                    </th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.table_name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.table_desc)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.model_name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.business_name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.function_name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.remark)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.create_time)
                        </td>
                        <td align="right">
                            <a asp-action="edit" asp-route-id="@item.id">修改</a> |
                            <a asp-action="delete" asp-route-id="@item.id" onclick="return confirm('确认删除吗？');">删除</a> |
                            <a class="a_generate" href="#" data-id="@item.id">生成代码</a>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        <div style="text-align: center;padding: 16px 0 12px 0;">
            <div class="layui-inline">
                @Html.Pager(Model, new PagerOptions
                {
                PageIndexParameterName = "page",
                TagName = "ul",
                CssClass = "pagination",
                CurrentPagerItemTemplate = "<li class=\"page-item active\"><a  class=\"page-link\" href=\"javascript:void(0);\">{0}</a></li>",
                DisabledPagerItemTemplate = "<li class=\"page-item disabled\"><a class=\"page-link\">{0}</a></li>",
                PagerItemTemplate = "<li class=\"page-item\">{0}</li>",
                PagerItemCssClass = "page-link",
                Id = "bootstrappager"
                })
            </div>
        </div>
    </div>
</div>
